package com.qifei.xmlg_backend.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qifei.xmlg_backend.DTO.logs.LogsQueryDTO;
import com.qifei.xmlg_backend.entity.Logs;
import com.qifei.xmlg_backend.entity.PageBean;
import com.qifei.xmlg_backend.entity.Result;
import com.qifei.xmlg_backend.service.ILogsService;
import io.swagger.annotations.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 操作日志
 *
 * @author logs
 * @since 2025-06-17
 */
@RestController
@RequestMapping("/logs")
@Slf4j
@RequiredArgsConstructor
public class LogsController {

    private final ILogsService logsService;

    /**
     * 分页获取日志
     */
    @GetMapping
    @Operation(summary = "分页查询日志")
    public Result<IPage<Logs>> getLogsPage(LogsQueryDTO queryDTO,@RequestParam(defaultValue = "1") Integer page,@RequestParam(defaultValue = "10") Integer pageSize) {
        IPage<Logs> logsPage = logsService.getLogsPage(queryDTO,page,pageSize);
        return Result.success(logsPage);
    }

}
